// Copyright (C) 2011  Andrew H. Chan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

#include "util.h"

using namespace std;

ostream& operator<<(ostream& os, bmatrix const& bmat) {
    uint n = bmat.size();
    uint m = bmat.at(0).size();
    for(uint i=0; i<n; ++i) {
        for(uint j=0; j<m-1; ++j) {
            os << bmat[i][j];
        }
        os << bmat[i][m-1];
        os << endl;
    }
    return os;
}

std::ostream& operator<<(std::ostream& os, bvector const& bv) { 
    for(uint i=0; i<bv.size(); ++i) {
        os << bv[i];
    }
    return os;
}

//std::ostream& operator<<(std::ostream& os, segmented_data const& seg_data) {
//    for(uint i=0; i < seg_data.size(); ++i) {
//        for(uint j=0; j < seg_data.at(0).size(); ++j) {
//            for(uint k=0; k < seg_data.at(i).at(j).size() - 1; ++k) {
//                os << seg_data[i][j][k];
//            }
//            os << seg_data[i][j][seg_data[i][j].size()-1];
//            os << ' ';
//        }
//        os << endl;
//    }
//    return os;
//}

template<>
ostream& operator<< <char>(ostream& os, vector<char> const& vec) {
    for(uint ii=0; ii<vec.size(); ++ii) {
        os << (int)vec[ii];
    }
    return os;
}

bvector append_bvectors(bvector const& a, bvector const& b) {
    bvector tmp;
    tmp = a;
    tmp.insert(tmp.end(), b.begin(), b.end());
    return tmp;
}
